package com.chang.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author: changzhenxi
 * @date: 2025年04月09日 11:15
 * @Version: 1.0
 * @description: spring中不允许出现七位布隆表达式(无法以年为单位) 1-7代表周一到周末 定时任务默认是阻塞状态的
 */
@Slf4j
@Component
@EnableScheduling
@EnableAsync // 开启异步任务
public class ScheduleTest {

    @Async
    @Scheduled(cron = "0 * * * * *")
    public void hello() throws InterruptedException {
        log.info("hello....");
        Thread.sleep(3000);
    }
}
